package com.bjsubway.gov.info.manager.dao;

import com.bjsubway.gov.info.manager.domain.Manager;

import java.io.*;
import java.util.ArrayList;

public class ManagerDao {
    private static ArrayList<Manager> manList = new ArrayList<>();

    //10001,小王,男,13112345678
    //10002,老于,男,13212345678
    //10003,老方,男,13312345678
    static {
        load();
    }
    public static void load() {
        try {
            BufferedReader br = new BufferedReader(new FileReader("bjsubway-gov-info-manager\\managers.txt"));
            String line;
            while ((line = br.readLine()) != null) {
                String[] split = line.split(",");
                Manager man = new Manager(split[0], split[1], split[2], split[3]);
                manList.add(man);
            }
            br.close();
        } catch (IOException e) {
        }
    }
    public ArrayList<Manager> login() {
        return manList;
    }
}
